const enterpriseVue = new Vue({
  el: '#app',
  data() {
    //校验身份证号
    return {
      form: {},		//表格数据
      rules: [],
      loading: false,
      disabled: false,
    }
  },
  mounted() {
    const mchid = sessionStorage.getItem("mchid")
    this.getList(mchid);
  },
  methods: {
    getList(mchid) {     //换页方法
      const _this = this
      $.ajax({
        type: 'POST',
        url: DomainName + '/getInquiryIDOriginal?token=' + $.cookie("token"), //查
        data: {
          Primary_Key_Name: "mchid",
          Primary_Key: mchid,
          Data: "wechatpay",
        },
        complete: function (XMLHttpRequest) {
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        success: function (Result) {
          _this.form = Result[0];
        },
        dataType: "json"
      });
    },
    submitForm() {
      let row = this.form
      const _this = this;
      _this.loading = true
      let data = {
        Data: JSON.stringify({
          Modify: { wechatpay: [row] }
        })
      };
      $.ajax({
        url: DomainName + '/getEditAction?token=' + $.cookie("token"),
        type: 'POST',
        data,
        error: function (array) {
          console.log(array);
          _this.$message.error("修改失败，请稍后再试")
        },
        complete: function (XMLHttpRequest) {
          _this.loading = false
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        success: function (res) {
          if (res.Status == "success") {
            _this.$message({
              type: 'success',
              message: '修改成功!'
            })
            window.history.go(-1);
          }
        }
      })
    }
  }
})